import aiohttp
import requests
import time
import asyncio


urls = [f'https://httpbin.org/get?age={i}'for i in range(10)]
# async def tast1():
#     for i in range(5):
        # response = requests.get(urls[i])
#         print(1)
#         await asyncio.sleep(1)
# async def tast2():
#     for i in range(5,10):
        # response = requests.get(urls[i])
#         print(2)
#         await asyncio.sleep(2)
# async def main():
#     await asyncio.gather(tast1(), tast2())

# tast = main()
# asyncio.run(tast)

async def fetch(session, url):
    async with session.get(url) as response:
        return await response.json()
async def main():
    async with aiohttp.ClientSession() as session:
        result = await asyncio.gather(*[fetch(session,f'https://httpbin.org/get?age={i}')for i in range(10)])
        for r in result:
            print(r)
asyncio.run(main())